
import axios from 'axios' 
import React , { useEffect, useState }from 'react';
import { Avatar, List } from 'antd';

//列表数据
const App: React.FC = () => {
    const [list,setList]=useState([])
    useEffect(()=>{
        axios.get('/api/article/list').then((res)=>{
            console.log('res',res)
            setList(res.data.rows)
        })
    },[])
    return (
        <List
    itemLayout="horizontal"
    dataSource={list}
    renderItem={(item, index) => (
      <List.Item>
        <List.Item.Meta
          avatar={<Avatar shape="square" size={64} src={`https://api.dicebear.com/7.x/miniavs/svg?seed=${index}`} />}
          title={item.title}
          description={item.createdAt}
        />
      </List.Item>
    )}
  />
    )
  
};

export default App;
